import request from '@/utils/request'

/**
 * 分页查询桌台
 * @param query
 * @return {*}
 */
export function pageDiningTable(query) {
  return request({
    url: 'table/dining_table/page',
    method: 'get',
    params: query
  })
}

/**
 * 更新状态
 * @param data
 * @return {AxiosPromise}
 */
export function updateStatus(data) {
  return request({
    url: 'table/dining_table/status',
    method: 'put',
    data: data
  })
}

/**
 * 通过id获取餐桌
 * @param id
 * @return {*}
 */
export function getDiningTableById(id) {
  return request({
    url: 'table/dining_table/' + id,
    method: 'get'
  })
}

/**
 * 保存或修改
 * @param data
 * @return {*}
 */
export function saveOrUpdateDiningTable(data) {
  return request({
    url: 'table/dining_table',
    method: data.id ? 'put' : 'post',
    data: data
  })
}

/**
 * 删除
 * @param ids
 * @return {*}
 */
export function deleteDiningTable(ids) {
  return request({
    url: 'table/dining_table',
    method: 'delete',
    data: ids
  })
}

/**
 * 批量保存
 * @param data
 * @return {AxiosPromise}
 */
export function saveDiningTableBatch(data) {
  return request({
    url: 'table/dining_table/batch',
    method: 'post',
    data: data
  })
}
